package net.sf.calibur.transport;

import java.net.SocketAddress;

import net.sf.calibur.msgbuf.MessageBean;
import net.sf.calibur.transport.message.CommandMessage;
import net.sf.calibur.transport.message.Message;


public interface Session {	
	public String getKey();
	public long getRequestTimestamp();
	public void setRequestTimestamp(long timestamp);
	public long getEstablishTimestamp();
	public int getReceiveSequence();
	public int incReceiveSequence();
	public boolean isCrypto();
	public void close();
	public boolean isClosed();
	public void setAttribute(Object key, Object value);
	public Object getAttribute(Object key);
	public Object getAttribute(Object key, Object valueOnAbsent);
	public Object removeAttribute(Object key);
	
	public void setCheckingHeartbeat(boolean check);
	public boolean isCheckingHeartBeat();
	
	public SessionManager getSessionManager();
	public SessionState getState();
	public void setState(SessionState state);
	public SocketAddress getRemoteAddress();
	
	public void sendMessage(Message message);
	public void sendCommandResponse(CommandMessage cm) throws Exception;
	public void pushCommand(int commandId, MessageBean mbean) throws Exception;
}